<?php
	ini_set("display_errors","2");
	include "inc/common.php";	
	include "tools/tools.php";
	require_once 'propel/util/PropelPager.php';
	
	$c = new Criteria();
	$serviceObjAry = ServiceHourPeer::doSelect($c);
	$dataCount = count($serviceObjAry);
	$html="<table>\n".
	      "<tr><th>學年度</th><th>班級</th><th>姓名</th><th>機構名稱</th><th>開始服務時間</th><th>結束服務時間</th><th>服務時數</th>\n".
	      "</tr>\n";		
	for($i=0;$i<$dataCount;$i++)
	{	
		$html.="<tr>\n";		
		$schYear = $serviceObjAry[$i]->getSchYear();
		$clas = $serviceObjAry[$i]->getClas();
		$name = $serviceObjAry[$i]->getName();
		$agent = $serviceObjAry[$i]->getAgent();
		$startTime = $serviceObjAry[$i]->getStartTime();
		$endTime = $serviceObjAry[$i]->getEndTime();
		$hour = $serviceObjAry[$i]->getHour();
		$html.="<td>$schYear</td>\n";
		$html.="<td>$clas</td>\n";
		$html.="<td>$name</td>\n";
		$html.="<td>$agent</td>\n";
		$html.="<td>$startTime</td>\n";
		$html.="<td>$endTime</td>\n";
		$html.="<td>$hour</td>\n";
		$html.="</tr>\n";					
	}
	$html.="</table>";
	echo $html;
	$criteria = new Criteria();	
	/**
	 * 
	 * @var PropelPager
	 */
	$pager = new PropelPager($criteria, 'ServiceHourPeer', 'doSelect', $page = 1, $rowsPerPage = 10);
	echo "total pages:".$pager->getTotalPages();			
?>